package com.rivulet.dawn.api.tools;


import java.io.Serializable;
import java.util.Objects;

/**
 * @author: xjc
 * @date: 2022/8/15 13:49
 **/
public class ResultFul<T> implements Serializable {
    private static final long serialVersionUID = 3L;
    private Integer code;
    private String msg;
    private Boolean result;
    private T data;

    public ResultFul(Integer code, String msg, Boolean result, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.result = result;
    }

    public ResultFul(Integer code, String msg, Boolean result) {
        this.code = code;
        this.msg = msg;
        this.result = result;
    }

    public static <T>ResultFul OK(T data) {
        return new ResultFul(100, "success",true,data);
    }

    public static <T>ResultFul OK() {
        return new ResultFul(100, "success",true);
    }

    public ResultFul() {
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Boolean getResult() {
        return result;
    }

    public void setResult(Boolean result) {
        this.result = result;
    }

    @Override
    public String toString() {
        return "ResultFul{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", result=" + result +
                ", data=" + data +
                '}';
    }
}
